package cn.xiaobai.enums;

/**
 * 状态码说明
 *
 * @Author yangdaji
 * @Date 2023/8/13
 * @PackageName cn.xiaobai.enums
 * @ClassName StateEnums
 */
public enum StateEnum {

    NOT_EXIST(-2, "系统目前未录入该年份信息"),
    DATE_ERROR(-1, "日期格式错误"),
    WORK_DAY(0, "工作日"),
    REST_DAY(1, "休息日"),
    HOLIDAY(2, "节假日"),
    Unknown(10001, "未知/参数错误");

    private Integer state;
    private String desc;

    StateEnum(Integer state, String desc) {
        this.state = state;
        this.desc = desc;
    }

    public static String getExplain(Integer state) {
        for (StateEnum item : values()) {
            if (item.getState().equals(state)) {
                return item.getDesc();
            }
        }
        return Unknown.getDesc();
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
